#include <iostream>

using namespace std;

class Solution {
private:
    string ans;
    int count = 0;
    bool dfs(string& str, int& n, int& k) {
        if (str.size() == n) {
            ans = str;
            count++;
            if (count == k) {
                return true;
            }
            return false;
        }
        char last_c = ' ';
        if (!str.empty()) {
            last_c = str.back();
        }
        for (char i = 'a'; i <= 'c'; i++) {
            if (i == last_c) {
                continue;
            }
            str.push_back(i);
            if (dfs(str, n, k)) {
                return true;
            }
            str.pop_back();
        }
        return false;
    }
public:
    string getHappyString(int n, int k) {
        string ans = "";
        dfs(ans, n, k);
        if (count < k) {
            return "";
        }
        return ans;
    }
};